/*
 * Copyright Eugen Stoian <stoian.e@gmail.com> 2010
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef TOKEN_H
#define TOKEN_H
#include <QString>
class Token
{
public:
    enum Type { Unknown,
                Identifier,
                Keyword,
                Number,
                Text,
                Operator,
                LParen,
                RParen,
                LBracket,
                RBracket,
                LBrace,
                RBrace,
                Comma,
                Semicolon,
                Eof
              };
    Token(const QString& str = "", Type type = Token::Unknown, int line = 0, int index = 0);
    inline Type getType() const;
    inline QString getString() const;
    inline int getLine() const;
    inline int getIndex() const;
    inline void getSourcePosition(int& line, int& index);
private:
    QString _tokenString;
    Type _tokenType;
    int _line;
    int _index;
};
/*
 * INLINE MEMBERS
 */
Token::Type Token::getType() const
{
    return _tokenType;
}
QString Token::getString() const
{
    return _tokenString;
}
int Token::getLine() const
{
    return _line;
}
int Token::getIndex() const
{
    return _index;
}

void Token::getSourcePosition(int& line, int& index)
{
    line = _line;
    index = _index;
}


#endif // TOKEN_H
